We present BUDDA (BUlge/Disk Decomposition Analysis), a new code devoted to perform a two-dimensional bulge/disk decomposition directly from the images of galaxies. The bulge component is fitted with a generalized Sersic profile whereas disks have an exponential profile. No other components are included. Bars and other sub-structures, like lenses, rings, inner bars and inner disks, are studied with the residual images obtained through the subtraction of bulges and disks from the original images. This means that a detailed structural analysis of galaxies may be performed with a small number of parameters, and sub-structures may be directly studied with no a priori assumptions. To illustrate its usefulness, we present the results obtained with a sample of 51 mostly early-type galaxies (but covering the whole Hubble sequence). These results show some of the applications in which the code may be used: the determination of parameters for Fundamental Plane and structural studies, quantitative morphological classification of galaxies and identification and study of hidden sub-structures. We have determined the structural parameters of the galaxies in our sample and found many examples of hidden inner disks in ellipticals, secondary bars, nuclear rings and dust lanes in lenticulars and spirals, and also wrong morphological classification cases.